<template>
	<joy-page class="">
		<jing-swiper></jing-swiper>
		<uni-grid :gridList="grid" show-border="false" @click="handleClickGrid" columnNum="4"></uni-grid>
		<uni-card title="教师">
			<uni-grid :gridList="teacher" show-border="false" @click="handleClickTeacher" columnNum="4"></uni-grid>
		</uni-card>
		
	</joy-page>
</template>
<script>
	import JingSwiper from "@/components/jing-swiper/jing-swiper.vue"
	import uniGrid from "@/components/uni-grid/uni-grid.vue"
	import uniCard from "@/components/uni-card/uni-card.vue"
	import mPageView from "@/components/m-page-view/m-page-view.vue"
	export default {
		components: {
			JingSwiper,
			uniGrid,
			uniCard,
			"joy-page": mPageView
		},
		data() {
			return {
				banner: [],
				grid: [],
				adList: [],
				teacher: [],
				ka: [],
			}
		},
		onLoad(query) {

			console.log("APP进入首页");

			this.getGrids();
			this.getKa()
		},
		methods: {
			
			
			handleClickGrid(o) {
				console.log(o)
			},
			handleClickTeacher(o){
				console.log(o)
				let index = o.index
				let item = this.teacher[index]
				console.log(item.path)
				uni.navigateTo({
					url: item.path
				})
			},
			

			getGrids() {
				this.grid = [{
					image: 'http://liuup.com/img/grid-3.png',
					text: '民法',
					path: '/pages/objectiveShorthand/index'
				}, {
					image: 'http://liuup.com/img/grid-3.png',
					text: '刑法',
					path: '/pages/subjectiveCase/index'
				}, {
					image: 'http://liuup.com/img/grid-3.png',
					text: '民诉',
					path: '/pages/discussMark/index'
				}, {
					image: 'http://liuup.com/img/grid-3.png',
					text: '民诉',
					path: '/pages/objectiveShorthand/index'
				}, {
					image: 'http://liuup.com/img/grid-3.png',
					text: '刑法',
					path: '/pages/subjectiveCase/index'
				}, {
					image: 'http://liuup.com/img/grid-3.png',
					text: '民法',
					path: '/pages/discussMark/index'
				}]

				this.teacher = [{
					image: 'http://liuup.com/img/grid-3.png',
					text: '张老师',
					path: '/pages/teacher/list'
				}, {
					image: 'http://liuup.com/img/grid-3.png',
					text: '张老师',
					path: '/pages/teacher/list'
				}, {
					image: 'http://liuup.com/img/grid-3.png',
					text: '张老师',
					path: 'teacher/list'
				}, {
					image: 'http://liuup.com/img/grid-3.png',
					text: '张老师',
					path: '/pages/teacher/list'
				}, {
					image: 'http://liuup.com/img/grid-3.png',
					text: '张老师',
					path: '/pages/teacher/list'
				}, {
					image: 'http://liuup.com/img/grid-3.png',
					text: '张老师',
					path: '/pages/teacher/list'
				}]
			},

		}
	}
</script>
<style lang="scss">
	@import url("../../common/uni/uni.css");

	body,
	page {
		min-height: 100%;
		display: flex;
		font-size: 32upx;
	}

	body.modal-open {
		position: fixed;
		width: 100%;
	}

	.ad-box {
		display: flex;
		justify-content: center;
		background: #fff;

		/* margin-top: 10upx; */
		.ad {
			image {

				width: 335upx;
				height: 185upx;
				margin: 15upx;
			}
		}
	}

	/* #ifdef MP-BAIDU */
	page {
		width: 100%;
		height: 100%;
		display: block;
	}



	swan-template {
		width: 100%;
		min-height: 100%;
		display: flex;
	}

	/* #endif */

	.content {
		display: flex;
		flex: 1;
		flex-direction: column;
		background-color: #efeff4;
		width: 100%;
	}

	.pad-10 {
		padding: 10upx;
	}

	.mt-10 {
		margin-top: 10upx;
	}

	.ellipsis {
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.input-row {
		display: flex;
		flex-direction: row;
		position: relative;
		background: #fff;
	}

	.input-row .title {
		width: 25%;
		padding: 20upx 0;
		padding-left: 20upx;
		line-height: 50upx;
	}

	.border-1px {
		position: relative;

		&::before {
			position: absolute;
			z-index: 1;
			right: 0;
			top: 0;
			left: 0upx;
			height: 1upx;
			content: '';
			-webkit-transform: scaleY(.5);
			transform: scaleY(.5);
			background-color: #e2e2e2;
		}

		&::after {
			position: absolute;
			z-index: 1;
			right: 0;
			bottom: 0;
			left: 0upx;
			height: 1upx;
			content: '';
			-webkit-transform: scaleY(.5);
			transform: scaleY(.5);
			background-color: #e2e2e2;
		}
	}

	.border-bottom-1px {
		position: relative;

		&::after {
			position: absolute;
			z-index: 1;
			right: 0;
			bottom: 0;
			left: 20upx;
			height: 1upx;
			content: '';
			-webkit-transform: scaleY(.5);
			transform: scaleY(.5);
			background-color: #e2e2e2;
		}
	}

	.btn-row {
		margin-top: 50upx;
		padding: 20upx;
	}

	button.primary {
		background-color: #0faeff;
	}

	.ka {
		width: 100%;
		height: 260upx;
		position: relative;

		&:after {
			content: '';
			position: absolute;
			transform-origin: center;
			box-sizing: border-box;
			pointer-events: none;
			top: -50%;
			left: -50%;
			right: -50%;
			bottom: -50%;
			border-bottom: 1px solid $uni-border-color;
			transform: scale(.5);
		}
	}


	.uni-media-list {
		padding: 10px 10px;
	}

	.uni-media-list-logo {
		width: 220upx;
		height: 160upx;
	}

	.uni-media-list-body {
		height: auto;
		justify-content: space-around;
	}

	.uni-media-list-text-top {
		// height: 60upx;
		font-size: 28upx;

	}

	.uni-media-list-text-body {
		// height: 60upx;
		font-size: 28upx;

	}

	.uni-media-list-text-bottom {
		// height: 60upx;
		font-size: 28upx;

	}

	.uni-list::before,
	.uni-list:after {
		height: 0px;
	}
</style>
